<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[start_time]" type="text" value="{$last_data.start_time}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[end_time]" type="text" value="{$last_data.end_time}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('添加日程')}:</label>
        <div class="col-xs-12 col-sm-8">
            <dl class="fieldlist" data-name="row[item]"  data-template="fieldtpl">
                <dd>
                    <ins style="width:20%">{:__('周几')}</ins>
                    <ins style="width:20%">{:__('第几节')}</ins>
                    <ins style="width:20%">{:__('选择科目')}</ins>
<!--                    <ins style="width:20%">{:__('科目')}</ins>-->
                </dd>
                <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
            </dl>
        </div>
    </div>
    <script type="text/html" id="fieldtpl">
        <dd class="form-inline">
            <select class="form-control selectpage" name="<%=name%>[<%=index%>][week]" style="width:20%">
                    <option value="1" >周一</option>
                    <option value="2" >周二</option>
                    <option value="3" >周三</option>
                    <option value="4" >周四</option>
                    <option value="5" >周五</option>
            </select>
            <select class="form-control selectpage" name="<%=name%>[<%=index%>][node]" style="width:20%">
                <option value="1" >1</option>
                <option value="2" >2</option>
                <option value="3" >3</option>
                <option value="4" >4</option>
                <option value="5" >5</option>
                <option value="6" >6</option>
            </select>
            <select class="form-control selectpage" name="<%=name%>[<%=index%>][type]" data-number="<%=index%>" style="width:20%" onchange="subject(this)">
                <option value="1" >主科</option>
                <option value="2" >科任</option>
                <option value="3" >班队会</option>
            </select>

            <select class="form-control selectpage subject1" name="<%=name%>[<%=index%>][subject_id1]" style="width:20%">
                <option value="">请选择</option>
                {foreach name="subject1" id="item"}
                <option value="{$item.id}">{$item.name}</option>
                {/foreach}
            </select>
            <select class="form-control selectpage subject2" name="<%=name%>[<%=index%>][subject_id2]" style="display:none;width:20%">
                <option value="">请选择</option>
                {foreach name="subject2" id="item"}
                <option value="{$item.id}">{$item.name}</option>
                {/foreach}
            </select>
            <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
        </dd>
    </script>

    <!--    <hr>-->
<!--    <div id="tab_3">-->

<!--        <div class="form-group">-->
<!--            <label  class="control-label col-xs-12 col-sm-2">选择周几:</label>-->
<!--            <div class="col-xs-12 col-sm-8">-->
<!--                <select   class="form-control selectpicker"  name="row[detail][0][type]">-->
<!--                    <option value="1" >周一</option>-->
<!--                    <option value="2" >周二</option>-->
<!--                    <option value="3" >周三</option>-->
<!--                    <option value="4" >周四</option>-->
<!--                    <option value="5" >周五</option>-->
<!--                </select>-->

<!--            </div>-->
<!--            <span><button type="button"  class="btn btn-danger" id="add_option2"  data-multiple="false" data-preview-id="p-image">添加</button></span>-->

<!--        </div>-->
<!--        <div class="form-group">-->
<!--            <label  class="control-label col-xs-12 col-sm-2">选择第几节:</label>-->
<!--            <div class="col-xs-12 col-sm-8">-->
<!--                <select   class="form-control selectpicker"  name="row[detail][0][type]">-->
<!--                    <option value="1" >1</option>-->
<!--                    <option value="2" >2</option>-->
<!--                    <option value="3" >3</option>-->
<!--                    <option value="4" >4</option>-->
<!--                    <option value="5" >5</option>-->
<!--                    <option value="6" >6</option>-->
<!--                </select>-->

<!--            </div>-->
<!--        </div>-->
<!--        <div class="form-group">-->
<!--            <label  class="control-label col-xs-12 col-sm-2">选择科目类型:</label>-->
<!--            <div class="col-xs-12 col-sm-8">-->
<!--                <select   class="form-control selectpicker"  name="row[detail][0][type]">-->
<!--                    <option value="1" >主科</option>-->
<!--                    <option value="2" >科任</option>-->
<!--                    <option value="3" >班队会</option>-->
<!--                </select>-->

<!--            </div>-->
<!--        </div>-->
<!--        <div class="form-group">-->
<!--            <label class="control-label col-xs-12 col-sm-2">{:__('科目')}:</label>-->
<!--            <div class="col-xs-12 col-sm-8">-->
<!--                <input  data-rule="required"  min="0"  data-source="general/subject/index" class="form-control selectpage subject_id" name="row[subject_id]" type="text" value="">-->
<!--            </div>-->
<!--        </div>-->
<!--        <hr>-->
<!--    </div>-->


    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script>
    function subject(data) {
        var type = $(data).val();
        if(type==1){
            $(data).next().next(".subject2").hide();
            $(data).next(".subject1").show();
        }else if(type==2){
            $(data).next().next(".subject2").show();
            $(data).next(".subject1").hide();
        }else if(type==3){
            $(data).next().next(".subject2").hide();
            $(data).next(".subject1").hide();
        }
    }
</script>